package org.dhbw.cocktail.mixer;

import java.util.List;
import org.dhbw.cocktail.Cocktail;
import org.dhbw.cocktail.CocktailType;
import org.dhbw.cocktail.Ingredient;

/**
 * Interface that interacts as facade for handling cocktails and it components
 * in the DAO
 * 
 * @author Roland von Werden
 * @version 0.0.1
 */
public interface ICocktailMixer {

	/**
	 * returns all persisted cocktails
	 * 
	 * @return
	 */
	public List<Cocktail> getAllCocktails();

	/**
	 * returns saved Cocktail on the basis of its id
	 * 
	 * @param id
	 *            Id of Cocktail
	 * @return
	 */
	public Cocktail getCocktailById(long id);

	/**
	 * returns Cocktails that contains a specific Ingredient
	 * 
	 * @param id
	 *            Identifier of the specific Ingredient
	 * @return
	 */
	public List<Cocktail> getCocktailsByIngredientId(long id);

	/**
	 * return a cocktail-type on the basis of its id
	 * 
	 * @param id
	 *            identifier of the cocktail-type
	 * @return
	 */
	public CocktailType getCocktailTypeById(long id);

	/**
	 * return all cocktail-types
	 * 
	 * @return
	 */
	public List<CocktailType> getCocktailTypes();

	/**
	 * reutrn a ingredient on the basis of its id
	 * 
	 * @param id
	 *            identifier of the wanted ingredient
	 * @return
	 */
	public Ingredient getIngredientById(long id);

	/**
	 * returns all persisted ingredients
	 * 
	 * @return
	 */
	public List<Ingredient> getIngredients();

	/**
	 * Mix a cocktail (means: reduce the amount left in the ingredients used by
	 * it on the basis how much the cocktail needs)
	 * 
	 * @param cocktail
	 *            cokctail to be mixed
	 * @param amount
	 *            how many times the cocktail should be mixed
	 * @return true = the cocktails could be mixed, false = there isnt enough
	 *         amount in the ingredients left
	 */
	public boolean mixCocktail(Cocktail cocktail, int amount);

	/**
	 * Persists an existing or new Cocktail
	 * @param cocktail cocktail to be saved
	 * @return returns whether it succeeded
	 */
	public boolean saveCocktail(Cocktail cocktail);

	/**
	 * Persists an existing or new Cocktail-type
	 * @param type cocktail-type to be saved
	 * @return returns whether it succeeded
	 */
	public boolean saveCocktailType(CocktailType type);

	/**
	 * Persists an existing or new Ingredient
	 * @param ingredient ingredient to be saved
	 * @return returns whether it succeeded
	 */
	public boolean saveIngredient(Ingredient ingredient);

	/**
	 * Persists an existing or new Ingredient
	 * @return returns whether it succeeded
	 */
	public boolean saveIngredient(String name, double quantity, String unit);

	/**
	 * Searches for cocktail that matches the search-string
	 * @param searchString searched string
	 * @return list of matched cocktails
	 */
	public List<Cocktail> searchCocktail(String searchString);

	/**
	 * Searches for ingredients that matches the search-string
	 * @param searchString searched string
	 * @return list of matched ingredients
	 */
	public List<Ingredient> searchIngredient(String searchString);
}
